/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


(function($){
    $.fn.extendedcontrols = function(options) {

        var defaults = {
            icon: "ui-icon-newwin",
            click: function(){}
        };
        var myoptions = $.extend(defaults, options);

        return this.each(function() {
            var control = $(this);
            var body = $("body");
            display = (myoptions.animate)?'control':'showcontrol';
            body.append('<div id="control_button" class="ui-widget ui-state-default ui-corner-right control"><a class="ui-state-default ui-corner-all" href="javascript:void(0);"><span class="ui-icon '+myoptions.icon+'" style=""></span></a></div>');
            control.focus(function(){
                $('.control > a').click(myoptions.click);
                $('.control').css('left',control.offset().left+control.outerWidth()-3);
                $('.control').css('top',control.offset().top-3);
                $('.control').show('slide',{
                    direction:'left'
                },1000);
            }
            );
            control.blur(function(){
                $('.control').hide('slide',1000);
            }
            );

        });
    };
})(jQuery);